package edu.gdkm.staticdemo;

public class Teacher {
    static int id =1000000;   //静态属性是全类共享的一个属性,所有对象共享,静态属性只初始化一次

    @Override
    public String toString() {
        return "Teacher{" +
                "name='" + name + '\'' +
                ", teacherid='" + teacherid + '\'' +
                '}';
    }

    String name;
    String teacherid;
    public Teacher(String name) {
        this.name = name;
        teacherid=String.valueOf(id++);
    }
}
